#include <stdio.h>
#include "..\..\include\guiapp.h"

GUIApp::GUIApp(HGE *hge) : hgeGUI () {
	myHge = hge;
	dummyCtrl *ctlr = new dummyCtrl ();
	AddCtrl(ctlr);
}

GUIApp::~GUIApp()
{
	delete cursorSprite;
}

bool GUIApp::LoadCursor ( const char*fname, float w, float h ) {
	cursorTexture = myHge->Texture_Load(fname);
	if ( cursorTexture ) {
		cursorSprite=new hgeSprite(cursorTexture,0,0,w,h);
		SetCursor(cursorSprite);
		return true;
	} else {
		return false;
	}
}

bool GUIApp::Input_GetKeyState (int key) {
	return myHge->Input_GetKeyState(key);
}

void GUIApp::PreRender () 
{
}

void GUIApp::PostRender () 
{
}

bool GUIApp::FrameFunc() 
{
	float dt=myHge->Timer_GetDelta();
	Update(dt);
	myHge->Gfx_BeginScene();
	myHge->Gfx_Clear(0);
	PreRender();
	Render();
	PostRender();
	myHge->Gfx_EndScene();
	return false;
}